﻿package core.ui.options
{
    import core.enum.*;
    import core.ui.controls.*;
    import flash.display.*;
    import flash.events.*;

    public class MarqueeOptions extends Sprite implements IToolOptions
    {
        private var ed:Tuyitu;
        private var selected:ActionButton;
        private var feather:Dropslider;
        private var antialias:Checkbox;

        public function MarqueeOptions(param1:Tuyitu)
        {
            this.ed = param1;
            var _loc_2:* = new ActionButton(param1, "rm_marquee_rectangular", Action.RectangularMarqueeTool, new MarqueeRectangular(), 2, 2);
            _loc_2.addEventListener(MouseEvent.MOUSE_DOWN, this.TypeMouseDown, false, 0, true);
            _loc_2.x = 10;
            _loc_2.y = 3;
            _loc_2.Mark(true);
            this.selected = _loc_2;
            addChild(_loc_2);
            var _loc_3:* = new ActionButton(param1, "rm_marquee_elliptical", Action.EllipticalMarqueeTool, new MarqueeElliptical(), 2, 2);
            _loc_3.addEventListener(MouseEvent.MOUSE_DOWN, this.TypeMouseDown, false, 0, true);
            _loc_3.x = 33;
            _loc_3.y = 3;
            addChild(_loc_3);
            var _loc_4:* = 60;
            var _loc_5:* = 15;
            var _loc_6:* = new BarSplit();
            _loc_6.x = _loc_4;
            addChild(_loc_6);
            _loc_4 = _loc_4 + (2 + _loc_5);
            _loc_4 = _loc_4 - 5;
            var _loc_7:* = new Literal("rm_feather");
            _loc_7.x = _loc_4;
            _loc_7.y = 2;
            addChild(_loc_7);
            _loc_4 = _loc_4 + _loc_7.width;
            this.feather = new Dropslider(50, 0, 100, 0);
            this.feather.x = _loc_4;
            this.feather.y = 2;
            addChild(this.feather);
            _loc_4 = _loc_4 + (50 + _loc_5);
            var _loc_8:* = new BarSplit();
            _loc_8.x = _loc_4;
            addChild(_loc_8);
            _loc_4 = _loc_4 + (2 + _loc_5);
            this.antialias = new Checkbox("rm_anti_alias");
            this.antialias.x = _loc_4;
            this.antialias.y = 3;
            this.antialias.Check();
            addChild(this.antialias);
            return;
        }// end function

        public function TypeMouseDown(event:MouseEvent) : void
        {
            if (this.selected != null)
            {
                this.selected.Mark(false);
            }
            this.selected = event.currentTarget as ActionButton;
            this.selected.Mark(true);
            return;
        }// end function

        public function get options() : Object
        {
            return {action:this.selected.action, feather:this.feather.value, antialias:this.antialias.checked};
        }// end function

    }
}
